package com.wbl.train.batch.job;

import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

/**
 * Author: 王博纶
 * Date: 2024/2/8 16:07
 * FileName: QuartzTestJob
 * Description: quartz框架的定时任务的测试类
 */
// 禁用并发执行
@DisallowConcurrentExecution
public class QuartzTestJob implements Job {

    /**
     * 定时任务执行的方法逻辑
     * @param jobExecutionContext job执行的上下文参数
     * @throws JobExecutionException 异常参数
     */
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        System.out.println("QuartzTestJob Test 开始");
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        System.out.println("QuartzTestJob Test 结束");
    }
}
